<!DOCTYPE html>





<html class="theme-next gemini use-motion" lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="generator" content="Hexo 3.9.0">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.3.0">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=7.3.0">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=7.3.0">
  <link rel="mask-icon" href="/images/logo.svg?v=7.3.0" color="#222">
  <meta name="google-site-verification" content="uSLhm-2JUAoM7eOTok7L19IyTJqp7dgwYpDu8dthN5Y" />

<link rel="stylesheet" href="/css/main.css?v=7.3.0">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/theme-next/theme-next-needmoreshare2@1/needsharebutton.min.css">
  <link rel="stylesheet" href="/lib/pace/pace-theme-center-atom.min.css?v=1.0.2">
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '7.3.0',
    exturl: false,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":true},
    back2top: {"enable":true,"sidebar":true,"scrollpercent":true},
    save_scroll: false,
    copycode: {"enable":true,"show_result":true,"style":"mac"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: '',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    }
  };
</script>

  <meta name="description" content="废话作为一个小白,在WEB方面的小白,搭建一个简单的静态博客确实费了许多精力.其中参考了无数资料,有官方的,非官方的……反正搭建不易,现在就详述一下,博客是怎么搭建起来的.">
<meta name="keywords" content="网站搭建">
<meta property="og:type" content="article">
<meta property="og:title" content="使用GitHub和HEXO的博客搭建过程">
<meta property="og:url" content="https://www.wootec.top/2019/08/18/使用GitHub和HEXO的博客搭建过程/index.html">
<meta property="og:site_name" content="Reverier 个人博客">
<meta property="og:description" content="废话作为一个小白,在WEB方面的小白,搭建一个简单的静态博客确实费了许多精力.其中参考了无数资料,有官方的,非官方的……反正搭建不易,现在就详述一下,博客是怎么搭建起来的.">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-10-02T13:22:29.484Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="使用GitHub和HEXO的博客搭建过程">
<meta name="twitter:description" content="废话作为一个小白,在WEB方面的小白,搭建一个简单的静态博客确实费了许多精力.其中参考了无数资料,有官方的,非官方的……反正搭建不易,现在就详述一下,博客是怎么搭建起来的.">
  <link rel="alternate" href="/atom.xml" title="Reverier 个人博客" type="application/atom+xml">
  <link rel="canonical" href="https://www.wootec.top/2019/08/18/使用GitHub和HEXO的博客搭建过程/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>使用GitHub和HEXO的博客搭建过程 | Reverier 个人博客</title>
  








  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  <div class="container sidebar-position-left">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Reverier 个人博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <p class="site-subtitle">Hope, Marvel, Youth.</p>
      
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
      
      
      
        
        <li class="menu-item menu-item-home">
      
    
      
    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-about">
      
    
      
    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-tags">
      
    
      
    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签<span class="badge">15</span></a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-categories">
      
    
      
    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类<span class="badge">11</span></a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-archives">
      
    
      
    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档<span class="badge">16</span></a>

  </li>
  </ul>

</nav>
</div>
    </header>

    

  <a href="https://github.com/Reverier-Xu" class="github-corner" title="My tour on GitHub" aria-label="My tour on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
            

          <div id="content" class="content page-post-detail">
            

  <div id="posts" class="posts-expand">
    

  <article class="post" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://www.wootec.top/2019/08/18/使用GitHub和HEXO的博客搭建过程/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Reverier Xu">
      <meta itemprop="description" content="Hope, Marvel, Youth.">
      <meta itemprop="image" content="/images/Reverier.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Reverier 个人博客">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">使用GitHub和HEXO的博客搭建过程

          
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              
                
              

              <time title="创建时间：2019-08-18 18:40:54" itemprop="dateCreated datePublished" datetime="2019-08-18T18:40:54+08:00">2019-08-18</time>
            </span>
          
            

            
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2019-10-02 21:22:29" itemprop="dateModified" datetime="2019-10-02T21:22:29+08:00">2019-10-02</time>
              </span>
            
          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/网站搭建/" itemprop="url" rel="index"><span itemprop="name">网站搭建</span></a></span>

                
                
              
            </span>
          

          
            <span class="post-meta-item" title="阅读次数">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
            </span>
          

                    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="废话"><a href="#废话" class="headerlink" title="废话"></a>废话</h1><p>作为一个小白,在WEB方面的小白,搭建一个简单的静态博客确实费了许多精力.其中参考了无数资料,有官方的,非官方的……反正搭建不易,现在就详述一下,博客是怎么搭建起来的.</p>
<a id="more"></a>

<p>没错,看到这个一级标题了吧,这篇文章里面不是一个水到渠成的方法,我会把我所踩过的坑以及踩坑用的方法写进来,所以……😜</p>
<p>噢,笔者很穷,用不起Mac,所以就不会Mac的做法咯~</p>
<p>原创,转载请注明来源</p>
<h1 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h1><h2 id="Git"><a href="#Git" class="headerlink" title="Git"></a>Git</h2><p>准备什么咧?因为我们的博客是建在GitHub上啦,所以你需要一个Git. <a href="https://git-scm.com/" target="_blank" rel="noopener">Git 下载地址</a> </p>
<p>按照Windows下面装软件的惯例,就 下一步 下一步 下一步 我同意 下一步 下一步 安装 完成 就装好啦~</p>
<p>如果是Linux, Git 应该已经集成到大部分的系统里啦~如果没有,就</p>
<p>DEB系: Debian, Ubuntu, Deepin, Linux Mint以及各种衍生版本,包括Kali Linux和Parrot Sec Linux</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt-get install git</span><br></pre></td></tr></table></figure>

<p>RedHat系: Fedora, RHEL, CentOS</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo dnf install git</span><br></pre></td></tr></table></figure>

<p>emmm如果是CentOS这种万年不更新的系统的话,用yum就好啦:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo yum install git</span><br></pre></td></tr></table></figure>

<p>Open SUSE: 没办法,SUSE自成一派,不过 YasT 确实好用,笔者电脑上就是Windows 10 + Open SUSE</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo zypper install git</span><br></pre></td></tr></table></figure>

<p>Arch系:Arch Linux, Manjaro, Gentoo</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo pacman -S git</span><br></pre></td></tr></table></figure>

<p>我猜装个git不需要用AUR吧😨</p>
<p>(别问笔者为啥各大Linux的安装包管理器背的这么熟练,说出来都是泪)</p>
<h2 id="Node-js"><a href="#Node-js" class="headerlink" title="Node.js"></a>Node.js</h2><p>好了,Git 装完了,接下来装Hexo(我们的主角)的必备依赖!</p>
<p>他就是Node.js!(反正笔者也没学过,感觉很厉害就是了) <a href="http://nodejs.cn/download/" target="_blank" rel="noopener">Node.js下载地址</a></p>
<h2 id="GitHub账号配置"><a href="#GitHub账号配置" class="headerlink" title="GitHub账号配置"></a>GitHub账号配置</h2><p>接下来我们得注册一个GitHub 账号…… 喂,这么重要的东西,应该早就有了吧(手动滑稽</p>
<p>咳</p>
<p>注册完后,我们继续……</p>
<p>现在我们来配置一下Git (什么?Hexo还没装呢?就先配置Git? )</p>
<p>Windows用户:</p>
<p>装好Git后,会有一个叫做Git Bash的东东出现在你的桌面上 ( Linux用户:不存在的 )</p>
<p>然后…… 你可以找个清闲的地方 ( 不是叫你喝茶 ) ,新建一个文件夹,取一个喜欢的名字. ( 喂,不是给女儿起名字,那么认真干嘛 ) 然后右键,选择Git Bash Here.</p>
<p>Linux用户: </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ mkdir ./MyBlog <span class="comment">##你喜欢就好</span></span><br><span class="line">$ <span class="built_in">cd</span> ./MyBlog <span class="comment">##进入这个目录</span></span><br></pre></td></tr></table></figure>

<p>然后,现在我们就可以把Windows和Linux统一起来说啦.</p>
<p>先配置一下你刚注册的账户~</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ git config --global user.name <span class="string">"你的GitHub用户名"</span></span><br><span class="line">$ git config --global user.email <span class="string">"你的GitHub注册邮箱"</span></span><br></pre></td></tr></table></figure>

<p>( 啥? 没有一个叫 你的GitHub用户名 的用户? 不至于吧,我说的是你的GitHub的用户名,不是叫”你的GitHub用户名”的用户😓)</p>
<p>我们为了避免每次使用都要输入密码登录,可以配置一个叫SSH Key的东西:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ ssh-keygen -t rsa -C <span class="string">"你的GitHub注册邮箱"</span></span><br></pre></td></tr></table></figure>

<p>( 你不至于连open-ssh都没有吧……那得是一个多么精简的系统 )</p>
<p>接下来会让你输入各种信息,啥都不输,无脑回车就行了.</p>
<p>然后找到生成的.ssh的文件夹中的id_rsa.pub密钥，将内容全部复制.</p>
<p>再然后…… ( 我为哈说啥都要带个然后 )</p>
<p>打开<a href="https://github.com/settings/keys" target="_blank" rel="noopener">GitHub_Settings_keys</a> 页面，新建new SSH Key</p>
<p>为了保证访问速度……我就不在博客上添加图片了哈,不然GitHub该生气了(手动滑稽</p>
<p>Title随便写,想写啥写啥,然后把刚刚复制的id_rsa.pub的内容粘贴到下面的Key里面,点击 Add SSH key,就OK啦!</p>
<p>然后我们回到Bash ( Linux用户别抬杠, 是个shell都可以, 笔者用的是zsh )</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ ssh git@github.com</span><br></pre></td></tr></table></figure>

<p>如果出现了 Hi XXXX! You’ve successfully……balabala……就说明配置成功啦! 具体原理如下:</p>
<p>引自知乎 <a href="https://zhuanlan.zhihu.com/p/26625249" target="_blank" rel="noopener">吴润的文章</a></p>
<blockquote>
<p>这里之所以设置GitHub密钥原因是，通过非对称加密的公钥与私钥来完成加密，公钥放置在GitHub上，私钥放置在自己的电脑里。GitHub要求每次推送代码都是合法用户，所以每次推送都需要输入账号密码验证推送用户是否是合法用户，为了省去每次输入密码的步骤，采用了ssh，当你推送的时候，git就会匹配你的私钥跟GitHub上面的公钥是否是配对的，若是匹配就认为你是合法用户，则允许推送。这样可以保证每次的推送都是正确合法的。</p>
</blockquote>
<h1 id="正式开始"><a href="#正式开始" class="headerlink" title="正式开始"></a>正式开始</h1><h2 id="安装HEXO"><a href="#安装HEXO" class="headerlink" title="安装HEXO"></a>安装HEXO</h2><p>当当当! 我们的主角HEXO要登场啦! </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm install -g hexo-cli</span><br></pre></td></tr></table></figure>

<p>在我们的Git Bash里使用这条指令来安装hexo!安装会 <del>比较</del> 狠 慢! 因为……我们有伟大的万里长城防火墙啊…… ( 逃</p>
<h2 id="初始化博客"><a href="#初始化博客" class="headerlink" title="初始化博客"></a>初始化博客</h2><p>安装好之后,检查一下你当前的路径是不是刚刚让你找的清闲之地——一个你想把博客布置起来的空文件夹.</p>
<p>怎么检查?</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ <span class="built_in">pwd</span></span><br></pre></td></tr></table></figure>

<p>然后看输出的路径是不是 xxx/MyBlog 或者其他你取的名字.</p>
<p>确认完毕后,输入:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo init</span><br></pre></td></tr></table></figure>

<p>开始初始化你的博客吧!</p>
<p>然后一屏令人目眩的代码飞过……</p>
<p>我们现在打开你的博客文件夹,就能看见下面多出了很多文件啦! </p>
<h2 id="本地预览博客"><a href="#本地预览博客" class="headerlink" title="本地预览博客"></a>本地预览博客</h2><p>输入:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ hexo g</span><br><span class="line">$ hexo s</span><br></pre></td></tr></table></figure>

<p>然后在浏览器点开 <a href="http://localhost:4000" target="_blank" rel="noopener">本地博客</a> 就能看见我们的博客啦!</p>
<h2 id="HEXO的正确使用姿势"><a href="#HEXO的正确使用姿势" class="headerlink" title="HEXO的正确使用姿势"></a>HEXO的正确使用姿势</h2><p>现在我们瞅一眼 hexo 的正确使用姿势:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ npm install hexo -g <span class="comment">#安装Hexo</span></span><br><span class="line">$ npm update hexo -g <span class="comment">#升级 </span></span><br><span class="line">$ hexo init <span class="comment">#初始化博客</span></span><br></pre></td></tr></table></figure>

<p>命令简写:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">$ hexo n <span class="string">"文章名称"</span> == hexo new <span class="string">"文章名称"</span> <span class="comment">#新建文章,注意,""里面是你的文章名称,不是 文章名称 ......</span></span><br><span class="line">$ hexo g == hexo generate <span class="comment">#生成本地文件</span></span><br><span class="line">$ hexo s == hexo server <span class="comment">#启动服务预览</span></span><br><span class="line">$ hexo d == hexo deploy <span class="comment">#部署到远程服务器</span></span><br><span class="line">$ hexo server <span class="comment">#Hexo会监视文件变动并自动更新，无须重启服务器</span></span><br><span class="line">$ hexo server -s <span class="comment">#静态模式</span></span><br><span class="line">$ hexo server -p 5000 <span class="comment">#更改端口</span></span><br><span class="line">$ hexo server -i 192.168.1.1 <span class="comment">#自定义 IP</span></span><br><span class="line">$ hexo clean <span class="comment">#清除缓存，若是网页正常情况下可以忽略这条命令</span></span><br></pre></td></tr></table></figure>

<p>就这样, 我们就可以掌握 hexo 的用法啦!</p>
<h2 id="发布到GitHub"><a href="#发布到GitHub" class="headerlink" title="发布到GitHub"></a>发布到GitHub</h2><p>看我们刚搭好的博客, 是不是有些激动?</p>
<p>什么? 嫌丑?</p>
<p>那不是现在要操心的事情……应当操心的是,如何才能发布到网站上?</p>
<p>这个时候,GitHub就要大显神威了. 打开你的GitHub页面, 然后新建一个仓库……仓库取名叫</p>
<figure class="highlight stylus"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">你的用户名<span class="selector-class">.github</span><span class="selector-class">.io</span></span><br></pre></td></tr></table></figure>

<p>我也不知道为啥非要写用户名,但是不写用户名后面的配置会出各种各样的奇怪问题……</p>
<p>然后创建就可以啦.</p>
<p>然后! 用Visual Studio Code / Vim / Emacs / Sublime / Atom / Kate / Notepad …… ( 是个编辑器都行 ) 打开位于博客文件夹下的_config.yml, 然后把光标扯到最下面, 看到尾端有一个deploy的东东,编辑一下:</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Deployment</span></span><br><span class="line"><span class="comment">## Docs: https://hexo.io/docs/deployment.html</span></span><br><span class="line"><span class="attr">deploy:</span></span><br><span class="line"><span class="attr">  type:</span> <span class="string">git</span></span><br><span class="line"><span class="attr">  repository:</span> <span class="string">git@github.com:你的用户名/你的用户名.github.io.git</span></span><br><span class="line"><span class="attr">  branch:</span> <span class="string">master</span></span><br></pre></td></tr></table></figure>

<p>回到Bash, 输入下面的指令安装部署插件:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>

<p>然后! 我们就可以很方便的部署网站啦! 两条指令搞定! </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ hexo clean <span class="comment">#清除上次的缓存</span></span><br><span class="line">$ hexo g -d <span class="comment">#等价于执行hexo g 后再执行一次 hexo d , 这两个指令已经介绍过了.</span></span><br></pre></td></tr></table></figure>

<p>打开 你的用户名.github.io,你的网站就已经部署好啦! </p>
<h1 id="日常使用"><a href="#日常使用" class="headerlink" title="日常使用"></a>日常使用</h1><p>那我们怎么写博客呢?</p>
<p>只要打开Git Bash, cd到你的博客文件夹 ( Windows用户可以点开博客文件夹,右键 Git Bash Here)然后输入:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new post <span class="string">"文章名称"</span></span><br></pre></td></tr></table></figure>

<p>就能新建一篇文章啦!</p>
<p>你可以去下载一个 <a href="https://typora.io/" target="_blank" rel="noopener">Typora</a> ,一款很好用的MarkDown编辑器–—–好用到你根本不会觉得你在写一个叫做MarkDown的标记语言…….事实上, 笔者现在仍旧对MarkDown保持着一股生疏感.安装好Typora之后,你可以打开设置,然后就可以设置每次打开的文件夹啦! 我们把文件夹设置为:</p>
<figure class="highlight taggerscript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">MyBlog<span class="symbol">\s</span>ource<span class="symbol">\_</span>posts</span><br></pre></td></tr></table></figure>

<p>以后写的文章就可以保存在这里啦! </p>
<p>想更新到GitHub的话,就是:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ hexo clean </span><br><span class="line">$ hexo g -d</span><br></pre></td></tr></table></figure>

<p>然后打开你的博客地址 : 你的用户名.github.io就可以看见你刚写的文章啦!</p>
<p>PS: 由于GitHub Pages需要每次重建,所以你可能不会很快的看见自己的文章咯~这样的话最好等上两分钟,你的文章就会出现在博客列表里啦!</p>
<h1 id="未完待续"><a href="#未完待续" class="headerlink" title="未完待续~"></a>未完待续~</h1><p>下集预告:安装Next主题, 配置我的博客!</p>

      
    </div>

    
    
    
<div>
  
    <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">--本文结束-😁-感谢您的阅读!--</div>
    
</div>

  
</div>
      

      

      
        
      
      

      

      <footer class="post-footer">
        
          
            
          
          <div class="post-tags">
            
              <a href="/tags/网站搭建/" rel="tag"><i class="fa fa-tag"></i> 网站搭建</a>
            
          </div>
        

        
  <div class="post-widgets">
    <div class="social-share">
      
      
        <div id="needsharebutton-postbottom">
          <span class="btn">
            <i class="fa fa-share-alt" aria-hidden="true"></i>
          </span>
        </div>
      
    </div>
  
  </div>


        
          <div class="post-nav">
            <div class="post-nav-next post-nav-item">
              
                <a href="/2019/08/18/The-Elementary-Of-Programming-Style/" rel="next" title="The Elementary Of Programming Style">
                  <i class="fa fa-chevron-left"></i> The Elementary Of Programming Style
                </a>
              
            </div>

            <span class="post-nav-divider"></span>

            <div class="post-nav-prev post-nav-item">
              
                <a href="/2019/08/19/用Next美化-HEXO-GitHub-博客/" rel="prev" title="用Next美化 HEXO & GitHub 博客">
                  用Next美化 HEXO & GitHub 博客 <i class="fa fa-chevron-right"></i>
                </a>
              
            </div>
          </div>
        
      </footer>
    
  </div>
  
  
  
  </article>
  </div>


          </div>
          
    
    
  <div class="comments" id="comments">
    <div id="lv-container" data-id="city" data-uid="MTAyMC80NjE1MC8yMjY2MQ=="></div>
  </div>
  
  

        </div>
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">

          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image"
      src="/images/Reverier.png"
      alt="Reverier Xu">
  <p class="site-author-name" itemprop="name">Reverier Xu</p>
  <div class="site-description motion-element" itemprop="description">Hope, Marvel, Youth.</div>
</div>
  <nav class="site-state motion-element">
      <div class="site-state-item site-state-posts">
        
          <a href="/archives/">
        
          <span class="site-state-item-count">16</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-categories">
        
          
            <a href="/categories/">
          
        
        
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
        <span class="site-state-item-count">11</span>
        <span class="site-state-item-name">分类</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-tags">
        
          
            <a href="/tags/">
          
        
        
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
        <span class="site-state-item-count">15</span>
        <span class="site-state-item-name">标签</span>
        </a>
      </div>
    
  </nav>
  <div class="feed-link motion-element">
    <a href="/atom.xml" rel="alternate">
      <i class="fa fa-rss"></i>RSS
    </a>
  </div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
      
      
        
      
      
        <a href="https://github.com/Reverier-Xu" title="GitHub &rarr; https://github.com/Reverier-Xu" rel="noopener" target="_blank">GitHub</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        <a href="https://stackoverflow.com/users/12383772/reverier" title="StackOverflow &rarr; https://stackoverflow.com/users/12383772/reverier" rel="noopener" target="_blank">StackOverflow</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        <a href="mailto:reverier.xu@gmail.com" title="E-Mail &rarr; mailto:reverier.xu@gmail.com" rel="noopener" target="_blank">E-Mail</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        <a href="https://weibo.com/dreamskytech" title="微博 &rarr; https://weibo.com/dreamskytech" rel="noopener" target="_blank">微博</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        <a href="https://www.zhihu.com/people/reverier-78/activities" title="知乎 &rarr; https://www.zhihu.com/people/reverier-78/activities" rel="noopener" target="_blank">知乎</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        <a href="https://user.qzone.qq.com/773389969" title="Qzone &rarr; https://user.qzone.qq.com/773389969" rel="noopener" target="_blank">Qzone</a>
      </span>
    
  </div>
  <div class="cc-license motion-element" itemprop="license">
    
  
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" rel="noopener" target="_blank"><img src="/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
  </div>


  <div class="links-of-blogroll motion-element links-of-blogroll-block">
    <div class="links-of-blogroll-title">
      <i class="fa  fa-fw fa-link"></i>
      友情链接~
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="https://www.std-frank.club/" title="https://www.std-frank.club/" rel="noopener" target="_blank">Frank</a>
        </li>
      
        <li class="links-of-blogroll-item">
          <a href="https://eqqie.cn/" title="https://eqqie.cn/" rel="noopener" target="_blank">赤道企鹅</a>
        </li>
      
        <li class="links-of-blogroll-item">
          <a href="https://cor1e.cn/" title="https://cor1e.cn/" rel="noopener" target="_blank">Cor1e</a>
        </li>
      
        <li class="links-of-blogroll-item">
          <a href="https://yunq1ao.com/" title="https://yunq1ao.com/" rel="noopener" target="_blank">yunq1ao</a>
        </li>
      
        <li class="links-of-blogroll-item">
          <a href="https://shal10w.github.io/" title="https://shal10w.github.io/" rel="noopener" target="_blank">shal10w</a>
        </li>
      
        <li class="links-of-blogroll-item">
          <a href="https://blog.csdn.net/arttnba3/" title="https://blog.csdn.net/arttnba3/" rel="noopener" target="_blank">arttnba3</a>
        </li>
      
    </ul>
  </div>


        </div>
      </div>
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#废话"><span class="nav-number">1.</span> <span class="nav-text">废话</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#准备工作"><span class="nav-number">2.</span> <span class="nav-text">准备工作</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#Git"><span class="nav-number">2.1.</span> <span class="nav-text">Git</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Node-js"><span class="nav-number">2.2.</span> <span class="nav-text">Node.js</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#GitHub账号配置"><span class="nav-number">2.3.</span> <span class="nav-text">GitHub账号配置</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#正式开始"><span class="nav-number">3.</span> <span class="nav-text">正式开始</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#安装HEXO"><span class="nav-number">3.1.</span> <span class="nav-text">安装HEXO</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#初始化博客"><span class="nav-number">3.2.</span> <span class="nav-text">初始化博客</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#本地预览博客"><span class="nav-number">3.3.</span> <span class="nav-text">本地预览博客</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#HEXO的正确使用姿势"><span class="nav-number">3.4.</span> <span class="nav-text">HEXO的正确使用姿势</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#发布到GitHub"><span class="nav-number">3.5.</span> <span class="nav-text">发布到GitHub</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#日常使用"><span class="nav-number">4.</span> <span class="nav-text">日常使用</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#未完待续"><span class="nav-number">5.</span> <span class="nav-text">未完待续~</span></a></li></ol></div>
            

          </div>
        </div>
      <!--/noindex-->
      
        <div class="back-to-top motion-element">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2019 – <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-free-code-camp"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Reverier Xu</span>
</div>
<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
  

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item-icon">
      <i class="fa fa-user"></i>
    </span>
    <span class="site-uv" title="总访客量">
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  
    <span class="post-meta-divider">|</span>
  
    <span class="post-meta-item-icon">
      <i class="fa fa-eye"></i>
    </span>
    <span class="site-pv" title="总访问量">
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>








        
      </div>
    </footer>
      <div class="reading-progress-bar"></div>

    
  
  <div id="needsharebutton-float">
    <span class="btn">
      <i class="fa fa-share-alt" aria-hidden="true"></i>
    </span>
  </div>
<script src="//cdn.jsdelivr.net/gh/theme-next/theme-next-needmoreshare2@1/needsharebutton.min.js"></script>
<script>
    pbOptions = {};
      pbOptions.iconStyle = "default";
    
      pbOptions.boxForm = "horizontal";
    
      pbOptions.position = "bottomCenter";
    
      pbOptions.networks = "Weibo,Wechat,Douban,QQZone,Twitter,Facebook";
    
    new needShareButton('#needsharebutton-postbottom', pbOptions);
    flOptions = {};
      flOptions.iconStyle = "default";
    
      flOptions.boxForm = "horizontal";
    
      flOptions.position = "middleRight";
    
      flOptions.networks = "Weibo,Wechat,Douban,QQZone,Twitter,Facebook";
    
    new needShareButton('#needsharebutton-float', flOptions);
</script>


  </div>

  
    
  
  <script color='0,0,255' opacity='0.5' zIndex='-1' count='99' src="/lib/canvas-nest/canvas-nest.min.js"></script>
  <script src="/lib/jquery/index.js?v=3.4.1"></script>
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

<script src="/js/utils.js?v=7.3.0"></script><script src="/js/motion.js?v=7.3.0"></script>

<script src="/js/schemes/pisces.js?v=7.3.0"></script>



<script src="/js/next-boot.js?v=7.3.0"></script>




  
  <script>
    (function(){
      var bp = document.createElement('script');
      var curProtocol = window.location.protocol.split(':')[0];
      bp.src = (curProtocol === 'https') ? 'https://zz.bdstatic.com/linksubmit/push.js' : 'http://push.zhanzhang.baidu.com/push.js';
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(bp, s);
    })();
  </script>




























  

  

  


  
  <script src="/js/scrollspy.js?v=7.3.0"></script><script src="/js/post-details.js?v=7.3.0"></script>


<script>
  window.livereOptions = {
    refer: location.pathname.replace(CONFIG.root, '').replace('index.html', '')
  };
  (function(d, s) {
    var j, e = d.getElementsByTagName(s)[0];
    if (typeof LivereTower === 'function') { return; }
    j = d.createElement(s);
    j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
    j.async = true;
    e.parentNode.insertBefore(j, e);
  })(document, 'script');
</script>

  <link rel="stylesheet" href="/dist/APlayer.min.css">
  <div id="aplayer"></div>
  <script type="text/javascript" src="/dist/APlayer.min.js"></script>
  <script type="text/javascript" src="/dist/music.js"></script>
</body>
</html>
<!-- 页面点击小红心 -->
<script type="text/javascript" src="/js/src/clicklove.js"></script>
